$(document).ready(function(){
    $("#admin-submit").click(function(){
        var userName = $("#adminname").val();
        $.ajax({
            type: "POST",
            url: 'http://59.110.114.107:8888/admin/login',
            data: {
                userName:$("#adminname").val(),
                password:$("#adminpassword").val()
            },
            dataType: "json",
            success: function (result) {

                if(result.meta.success){
                    window.localStorage.setItem("admin", userName);
                    window.location.href = "manage.html";
                }else{
                    alert(result.meta.message);
                }
            },
            error:function(){
                alert("网络错误");
            }
        });
    });
})